<template>
    用户名:
    <input type="text" v-model="membername" >
    性别:
   <select v-model="MemberSex">
    <option :value="0">请选择</option>
    <option :value="1">男</option>
    <option :value="2">女</option>
   </select>
   <input type="button" value="查询" @click="Show">
<table border="1">
    <thead>
        <tr>
        <td>用户名</td>
        <td>性别</td>
        <td>邮箱</td>
        <td>联系方式</td>
        <td>会员类型名称</td>
    </tr>
    </thead>
    <tbody v-for="init in info">
        <tr>
        <td>{{ init.M_Name }}</td>
        <td>{{ init.M_Sex?"男":"女" }}</td>
        <td>{{ init.M_Email }}</td>
        <td>{{ init.M_Phone }}</td>
        <td>{{ init.Name }}</td>
        <td>操作</td>
    </tr>
    </tbody>
  
</table>
</template>

<script setup lang="ts">
import axios from 'axios';
import { onMounted,ref } from 'vue';
//钩子 自己执行
onMounted (()=>{
 Show();
})

const membername=ref("")
const MemberSex=ref(0)

const info=ref([
    {
    "Name": "",
    "M_Name": "",
    "M_Phone": "",
    "M_Email": "",
    "M_Sex": true
}
])
const Show=()=>{
    axios.get("https://localhost:7198/api/Member/Show",
    {
        params:{
            name:membername.value,
            sex:MemberSex.value
        }
    })
    .then(res=>{
        info.value=res.data;
    })
}






</script>

